package com.chj;

import com.chj.annotation.ConsumerAnnotationService;
import com.chj.config.ConsumerConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.io.IOException;

/**
 * 注解方式启动
 */
public class ConsumerAppAnnotation {
    public static void main( String[] args ) throws IOException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
                ConsumerConfiguration.class);
        context.start(); // 启动
        ConsumerAnnotationService consumerAnnotationService = context.getBean(ConsumerAnnotationService.class);
        String hello = consumerAnnotationService.getDetail("hankin"); // 调用方法
        System.out.println("result: " + hello); // 输出结果

    }
}
